using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Yunwei.Domain.Models.Mapping
{
    public class RestaurantIngredientRelMap : EntityTypeConfiguration<RestaurantIngredient>
    {
        public RestaurantIngredientRelMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Unit)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.Cost).IsRequired();
            this.Property(t => t.Stock).IsRequired();
            this.Property(t => t.Vendor_Id).IsRequired();
            this.Property(t => t.Restaurant_Id).IsRequired();
            this.Property(t => t.Ingredient_Id).IsRequired();

            // Table & Column Mappings
            this.ToTable("RestaurantIngredientRel");

            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Cost).HasColumnName("Cost");
            this.Property(t => t.Stock).HasColumnName("Stock");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.Unit).HasColumnName("Unit");
            this.Property(t => t.Vendor_Id).HasColumnName("Vendor_Id");
            this.Property(t => t.Restaurant_Id).HasColumnName("Restaurant_Id");
            this.Property(t => t.Ingredient_Id).HasColumnName("Ingredient_Id");
        }
    }
}
